<?php


namespace App\Transformers\System;


use App\Models\SystemConfig;
use League\Fractal\TransformerAbstract;

class SystemConfigTransformer extends TransformerAbstract
{
    public function transform(SystemConfig $data)
    {
        return [
            'id' => $data->id,
            'menu_name' => $data->menu_name ?? '',
            'category_id' => $data->category_id ?? '',
            'type' => $data->type ?? '',
            'input_type' => $data->input_type ?? '',
            'parameter' => $data->parameter ?? '',
            'upload_type' => $data->upload_type ?? '',
            'required' => $data->required ?? '',
            'width' => $data->width ?? '',
            'height' => $data->height ?? '',
            'value' => $data->value ?? '',
            'info' => $data->info ?? '',
            'desc' => $data->desc ?? '',
            'status' => $data->status ?? '',
            'created_at' => $data->created_at ? $data->created_at->format("Y-m-d H:i:s") : '',
            'updated_at' => $data->updated_at ? $data->updated_at->format("Y-m-d H:i:s") : '',
            'deleted_at' => $data->deleted_at ? $data->deleted_at->format("Y-m-d H:i:s") : '',
        ];
    }
}
